<@mits.headerDiv />
   <script type='text/javascript' src='${base}/dwr/interface/trackLogMgr.js'></script>
  <script type='text/javascript' src='${base}/dwr/engine.js'></script>
  <script type='text/javascript' src='${base}/dwr/util.js'></script>
  <style>

table.listTable3{
}
table.listTable3 th{
	background:#ebebed;
	height:20px;
	line-height:20px;
	padding-left:1px;
	color:#000000;
	font-weight:normal;
	text-align:left;
	border-bottom:1px solid #dfdfdf;
	border-left:1px solid #DFDFDF;
}
table.listTable3 td{
	height:20px;
	border-bottom:1px solid #dfdfdf;
	padding-left:1px;
	text-align:left;
	border-left:1px solid #DFDFDF;
}
table.listTable3 td ul.control{
	margin:0;
	padding:0;
	list-style:none;
	position:relative;
}
table.listTable3 tr.foot td{
	padding:0 5px;
	background:#f8f8f8;
	text-align:right;
	border-bottom:1px solid #dfdfdf;
}  
  </style>
<div class="Main" id="Main">
	<!--屏幕切换-->
	<!--左边-->

	<!--右边-->
	<div class="Main_body" id="Main_body">
		<div class="Main_right_top" valign="middle">
		  <div class="Main_bodyListBar_head">统计条件 </div>
		 <br>
		 <form method="post" action="" id="myform" name="myform">
		 	<table border="0" cellspacing="1" cellpadding="0" class="addTable" >
 				<tr valign="middle">
                    <td width="12%">部门：</td>
                  	<td  width="12%">
					<select width="50" onChange="changeDept(this.value)" id="statisticsDto.departmentId" name="statisticsDto.departmentId">
					<option value="-1">全部</option>	
					<#if allDepartments?exists>
	                <#list allDepartments as department>
	                <option value="${department?if_exists.id?if_exists}" <#if statisticsDto?exists && statisticsDto.departmentId?exists><#if statisticsDto.departmentId == department.id >selected</#if></#if>>${department?if_exists.departmentName?if_exists}</option>
	                </#list>
	                </#if>
					</select>  
					</td>
                    <td  width="12%">监控点：</td>
                  	<td  width="12%">
					<select width="50" onChange="changePassPort(this.value)" id="statisticsDto.passportName" name="statisticsDto.passportName">
					<option value="all">全部</option>	
					<#if passPorts?exists>
	                <#list passPorts as passport>
	                <option value="${passport?if_exists.passPortName?if_exists}" <#if statisticsDto?exists && statisticsDto.passportName?exists><#if statisticsDto.passportName == passport.passPortName >selected</#if></#if>>${passport?if_exists.passPortName?if_exists}</option>
	                </#list>
	                </#if>		
					</select>  					
					</td>
					 <td  width="12%">方向：</td>
                  	<td  width="12%">
					<select width="50" id="statisticsDto.direction" name="statisticsDto.direction">
					<option value="all">全部</option>	
					<#if directions?exists>					
	                <#list directions as direction>	                 
	                <option value="${direction?if_exists}" <#if statisticsDto?exists && statisticsDto.direction?exists><#if statisticsDto.direction == direction >selected</#if></#if>>${direction?if_exists}</option>
	                </#list>
	                </#if>									
					</select>    
					</td>
                    <td  width="12%">车道：</td>
                  	<td  width="12%">
					<select width="50" id="statisticsDto.laneName" name="statisticsDto.laneName">
					<option value="all">全部</option>	
					
					<#list 1..8 as i>　
					<#assign tmp = i>
					<option value="${tmp}" <#if statisticsDto?exists && statisticsDto.laneName?exists && statisticsDto.laneName?if_exists?string ==  tmp?string>selected</#if>>${i}</option>
					</#list>				
					</select>  
					</td>					
			   </tr>		 			
                        <tr valign="middle">
                          <td  width="12%">统计类别：</td>
                          <td  width="12%"><select width="50" onchange="timeSwitch()"  id="statisticsDto.statisticsType" name="statisticsDto.statisticsType">
					<option value="hour" <#if statisticsDto?exists && statisticsDto.statisticsType?exists && statisticsDto.statisticsType?if_exists== 'hour'>selected</#if>>时</option>	
					<option value="day" <#if statisticsDto?exists && statisticsDto.statisticsType?exists && statisticsDto.statisticsType?if_exists== 'day'>selected</#if>>天</option>	
					<option value="month" <#if statisticsDto?exists && statisticsDto.statisticsType?exists && statisticsDto.statisticsType?if_exists== 'month'>selected</#if>>月</option>	
					</select></td>
                            <td colspan="5"  width="60%">时间段：
						<span id="hour_panel"> 
					 <input type="text" class="input_calendar" readonly onclick="displayCalendar('',$('statisticsDto.hourDate'),'yyyy-mm-dd',this)" name="statisticsDto.hourDate" id="statisticsDto.hourDate" value="<#if  statisticsDto?exists && statisticsDto.hourDate?exists>${statisticsDto?if_exists.hourDate}</#if>"/>
					 <select id="statisticsDto.startHour" name="statisticsDto.startHour">
					<#list 0..23 as i>　
					<option value="${i}" <#if statisticsDto?exists && statisticsDto.startHour?exists && statisticsDto.startHour?if_exists== i>selected</#if>>${i}</option>
					</#list>				
					</select>时
					<select id="statisticsDto.startMinute" name="statisticsDto.startMinute">
					<#list 0..59 as j>　
					<option value="${j}" <#if statisticsDto?exists && statisticsDto.startMinute?exists && statisticsDto.startMinute?if_exists== j>selected</#if>>${j}</option>
					</#list>				
					</select>分					
					 ～ 					
				 <select id="statisticsDto.endHour" name="statisticsDto.endHour">
					<#list 0..23 as m>　
					<option value="${m}" <#if statisticsDto?exists && statisticsDto.endHour?exists && statisticsDto.endHour?if_exists== m>selected</#if>>${m}</option>
					</#list>				
					</select>时
					<select id="statisticsDto.endMinute" name="statisticsDto.endMinute">
					<#list 0..59 as n>　
					<option value="${n}" <#if statisticsDto?exists && statisticsDto.endMinute?exists && statisticsDto.endMinute?if_exists== n>selected</#if>>${n}</option>
					</#list>				
					</select>分						
					</span>

					<span id="day_panel" style="display: none">
							<input type="text" class="input_calendar" readonly onclick="displayCalendar('',$('statisticsDto.dayStartDate'),'yyyy-mm-dd',this)" name="statisticsDto.dayStartDate" id="statisticsDto.dayStartDate" value="<#if  statisticsDto?exists && statisticsDto.dayStartDate?exists>${statisticsDto.dayStartDate?if_exists?string("yyyy-MM-dd")}</#if>"/>
								～
							<input type="text" class="input_calendar" readonly onclick="displayCalendar('',$('statisticsDto.dayEndDate'),'yyyy-mm-dd',this)" name="statisticsDto.dayEndDate" id="statisticsDto.dayEndDate" value="<#if  statisticsDto?exists && statisticsDto.dayEndDate?exists>${statisticsDto.dayEndDate?if_exists?string("yyyy-MM-dd")}</#if>"/>
	
					</span>

					<span id="month_panel" style="display: none"> 
					 <select id="statisticsDto.startYear" name="statisticsDto.startYear">
						
					<#list currentYear..(currentYear-10) as n>　
					<option value="${n}" <#if statisticsDto?exists && statisticsDto.startYear?exists && statisticsDto.startYear?if_exists== n>selected</#if>>${n}</option>
					</#list>				
					</select>
					<select id="statisticsDto.startMonth" name="statisticsDto.startMonth">
					<#list 1..12 as m>　
					<option value="${m}" <#if statisticsDto?exists && statisticsDto.startMonth?exists && statisticsDto.startMonth?if_exists== m>selected</#if>>${m}</option>
					</#list>				
					</select>
					～
					<select id="statisticsDto.endMonth" name="statisticsDto.endMonth">
					<#list 1..12 as m>　
					<option value="${m}" <#if statisticsDto?exists && statisticsDto.endMonth?exists && statisticsDto.endMonth?if_exists== m>selected</#if>>${m}</option>
					</#list>				
					</select>					
				</span>
			 </td> 
			 <td nowrap ><input type="button"  value="统  计" class="button" onclick="search()"/> &nbsp;
			 <input type="button"  value="导  出" class="button" onclick="window.location='${base}/exportTrackLog'"/></td>
			 </tr>
			 </table >
		</form>		</div>	
		<div class="Main_right_line"></div>
		
		  <div class="Main_bodyListBar">
				<div class="Main_bodyListBar_head"> </div>				
	    <div class="Main_bodyListBar_body">
	   <table border="0" cellpadding="0" cellspacing="0" >
					<tr >
					<td width="35%" valign="top">
					 <div style="height:400px;border:solid 1px;overflow-x:hidden;overflow-y:auto">
		  			<table border="0" cellpadding="1" cellspacing="2"  class="listTable3">
					<tr>					 
					  <th width="40%"  nowrap>时间</th>
					  <th width="60%"  nowrap>流量</th>			
					</tr>
					<#if dataset?exists>
					<#list dataset as se>
					<tr onmouseover="listTable_trMouseOver(this)" onmouseout="listTable_trMouseOut(this)">					 					
				      <td width="40%"  nowrap>${se?if_exists.kay?if_exists}</td> 
					  <td width="60%"  nowrap>${se?if_exists.value?if_exists}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
					  </tr>
					</#list>
					</#if>
					</table>
					 </div>
					</td>
						<td  width="2%" valign="top">
						</td>
					<td  width="70%" valign="top">
				<div style="text-align: center; height: auto;">
	${map?if_exists} <#if filename?exists>
	<img usemap="#${filename?if_exists}" src="${base}/servlet/DisplayChart?filename=${filename?if_exists}" border="0" />
	<#else>
	<font color="red"><strong><@ww.text name="tld.report.chart.error"/></strong></font> 
	</#if>
	<!--img src="temp/chart03.gif"/-->
</div>
			</div>
			</td>
			</tr>
			</table>
				<div class="Main_bodyListBar_bottom">
				  <div class="Main_bodyListBar_button"> 
				  </div>
					
				</div>
			<div class="Main_bodyListBar_foot"></div>
		  </div>
		</div>
	
</div>
<script lanague ="javascript">
//alert(window.parent.document.body.clientWidth);
function changeDept(deptId) {

    var passPort = $('statisticsDto.passportName');
    var len = passPort.length;

   for(var j= 0;j<len;j++){
    	passPort.selectedIndex = 0;
      	passPort.remove(1);
   }
    var direction = $('statisticsDto.direction');
    var dlen = direction.length;
   for(var j= 0;j<dlen;j++){
    	direction.selectedIndex = 0;
      	direction.remove(1);
   }   
   
   direction.selectedIndex = 0;
	trackLogMgr.getPassPortsByDeptId(deptId, fillPassPort);
}

function fillPassPort(data){	
    var passPort = $('statisticsDto.passportName');
	for(var i=0;i<data.length;i++){
   	 var o = data[i];
       var option = new Option(o.passPortName,o.passPortName,false,false);
      passPort.options[i+1] =option;
    }
    passPort.selectedIndex = 0;
}
function changePassPort(passPortName) {
    var direction = $('statisticsDto.direction');
    var len = direction.length;
   for(var j= 0;j<len;j++){
    	direction.selectedIndex =0;
      	direction.remove(1);
   }
    direction.selectedIndex = 0;
   if(passPortName != 'all') 
	trackLogMgr.getDirectionsByPassPortName(passPortName, fillDirection);
}
function fillDirection(data){	
    var direction = $('statisticsDto.direction');
		for(var i=0;i<data.length;i++){
	   	 var o = data[i];
	       var option = new Option(o,o,false,false);
	      direction.options[i+1] =option;
	    }
 
}
 function search() {
 	trimAllElements($('myform'));
 
 var o = $('statisticsDto.statisticsType');
 
 if(o.value == 'hour'){
  if(parseInt($('statisticsDto.startHour').value) > parseInt($('statisticsDto.endHour').value)) {
    alert("开始时间大于结束时间，请重新选择");
 	 return;
  }

 }else if(o.value == 'day'){
 
  var dt1 = $('statisticsDto.dayStartDate').value;
  var dt2 = $('statisticsDto.dayEndDate').value;
  if(!check(dt1,dt2)) {
    alert("请选择同一月份！");
    return;
  }
  if(!comptime(dt1,dt2)) {
 	 alert("开始时间大于结束时间，请重新选择");
 	 return;
 	}
 }else if(o.value == 'month'){
  if(parseInt($('statisticsDto.startMonth').value) > parseInt($('statisticsDto.endMonth').value)) {
    alert("开始时间大于结束时间，请重新选择");
 	 return;
  }
 }
	
    if(Validator.Validate($('myform'),3)){
  		$('myform').action = "${base}/auth/system/statistics.action?cleanSucMsg=true&clientWidth="+window.parent.document.body.clientWidth;
  		$('myform').submit();
    }
    	
 }
 function check(dt1 ,dt2){
//    var dt1 = document.forms[0].d1.value;
//    var dt2 = document.forms[0].d2.value;
    dt1 = new Date(dt1.replace(/-/g,"/"));
    dt2 = new Date(dt2.replace(/-/g,"/"));
	if(dt1.getYear() != dt2.getYear() ) {
	 return false;
	}
    if(dt1.getMonth()==dt2.getMonth()) {
    	return true;
    }else {
      return false;
    }
}
 timeSwitch=function (){
  var o =$('statisticsDto.statisticsType');	
	if(o.value == 'hour'){
		$('hour_panel').style.display = "";
		$('day_panel').style.display = "none";
		$('month_panel').style.display = "none";
	}else if(o.value == 'day'){
		$('hour_panel').style.display = "none";
		$('day_panel').style.display = "";
		<#if  statisticsDto?exists && statisticsDto.dayStartDate?exists>
		$('day_panel').style.display = "";
		 <#else>
		 $('statisticsDto.dayStartDate').value = new Date().format("yyyy-MM-dd").toString();
		 </#if>
		 <#if  statisticsDto?exists && statisticsDto.dayEndDate?exists> 
		 <#else>
		  $('statisticsDto.dayEndDate').value = new Date().format("yyyy-MM-dd").toString(); 
		  </#if>
		$('month_panel').style.display = "none";
	}else if(o.value == 'month'){
		$('hour_panel').style.display = "none";
		$('day_panel').style.display = "none";
		$('month_panel').style.display = "";
	}
};
 
 //比较时间 格式 yyyy-mm-dd hh:mi:ss 
 function comptime(beginTime,endTime){
 
	beginTime = beginTime + " 00:00:00";
	endTime = endTime + " 00:00:00";
	var beginTimes=beginTime.substring(0,10).split('-');
	
	var endTimes=endTime.substring(0,10).split('-');
	beginTime=beginTimes[1]+'-'+beginTimes[2]+'-'+beginTimes[0]+' '+beginTime.substring(10,19);
	endTime=endTimes[1]+'-'+endTimes[2]+'-'+endTimes[0]+' '+endTime.substring(10,19);
	//alert(beginTime+"|beginTime");
	//alert(endTime+"|endTime");
	var a =(Date.parse(endTime)-Date.parse(beginTime))/3600/1000;
	if(a<0){
		return false;
	}else if (a>0){
		return true;
	}else if (a==0){
		return true;
	}
} 
timeSwitch();
  </script>
<@mits.footerDiv />


